<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
  <database name="default" defaultIdMethod="none">
    <table name="C_ORDER">
      <column name="C_ORDER_ID" primaryKey="true" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="AD_CLIENT_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="AD_ORG_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="ISACTIVE" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
      <column name="CREATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="CURRENT_TIMESTAMP" autoIncrement="false"/>
      <column name="CREATEDBY" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="CURRENT_TIMESTAMP" autoIncrement="false"/>
      <column name="UPDATEDBY" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="ISSOTRX" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
      <column name="DOCUMENTNO" primaryKey="false" required="true" type="VARCHAR" size="30" autoIncrement="false"/>
      <column name="DOCSTATUS" primaryKey="false" required="true" type="CHAR" size="2" autoIncrement="false"/>
      <column name="DOCACTION" primaryKey="false" required="true" type="CHAR" size="2" autoIncrement="false"/>
      <column name="PROCESSING" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
      <column name="PROCESSED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="C_DOCTYPE_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="C_DOCTYPETARGET_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="DESCRIPTION" primaryKey="false" required="false" type="VARCHAR" size="255" autoIncrement="false"/>
      <column name="ISAPPROVED" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
      <column name="ISCREDITAPPROVED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="ISDELIVERED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="ISINVOICED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="ISPRINTED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="ISTRANSFERRED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="ISSELECTED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="SALESREP_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="DATEORDERED" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
      <column name="DATEPROMISED" primaryKey="false" required="false" type="TIMESTAMP" size="7" autoIncrement="false"/>
      <column name="DATEPRINTED" primaryKey="false" required="false" type="TIMESTAMP" size="7" autoIncrement="false"/>
      <column name="DATEACCT" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
      <column name="C_BPARTNER_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="C_BPARTNER_LOCATION_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="POREFERENCE" primaryKey="false" required="false" type="VARCHAR" size="20" autoIncrement="false"/>
      <column name="ISDISCOUNTPRINTED" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
      <column name="C_CURRENCY_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="PAYMENTRULE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
      <column name="C_PAYMENTTERM_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="INVOICERULE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
      <column name="DELIVERYRULE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
      <column name="FREIGHTCOSTRULE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
      <column name="FREIGHTAMT" primaryKey="false" required="false" type="DECIMAL" default="0" autoIncrement="false"/>
      <column name="DELIVERYVIARULE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
      <column name="M_SHIPPER_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="C_CHARGE_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="CHARGEAMT" primaryKey="false" required="false" type="DECIMAL" default="0" autoIncrement="false"/>
      <column name="PRIORITYRULE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
      <column name="TOTALLINES" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
      <column name="GRANDTOTAL" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
      <column name="M_WAREHOUSE_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="M_PRICELIST_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
      <column name="ISTAXINCLUDED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="C_CAMPAIGN_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="C_PROJECT_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="C_ACTIVITY_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="POSTED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="C_PAYMENT_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="C_CASHLINE_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="SENDEMAIL" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="AD_USER_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="COPYFROM" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
      <column name="ISSELFSERVICE" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="AD_ORGTRX_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="USER1_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="USER2_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="C_CONVERSIONTYPE_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="BILL_BPARTNER_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="BILL_LOCATION_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="BILL_USER_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="PAY_BPARTNER_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="PAY_LOCATION_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="REF_ORDER_ID" primaryKey="false" required="false" type="ID" size="10" autoIncrement="false"/>
      <column name="ISDROPSHIP" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
      <column name="VOLUME" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
      <column name="WEIGHT" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
      <foreign-key foreignTable="AD_ORG" name="ADORGTRX_CORDER" onDelete="none">
        <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
      </foreign-key>
      <foreign-key foreignTable="AD_ORG" name="ADORG_CORDER" onDelete="none">
        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
      </foreign-key>
      <foreign-key foreignTable="AD_USER" name="ADUSER_SR_CORDER" onDelete="none">
        <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="AD_USER" name="ADUSERBILL_CORDER" onDelete="none">
        <reference local="BILL_USER_ID" foreign="AD_USER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="AD_USER" name="ADUSER_CORDER" onDelete="none">
        <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_CORDER" onDelete="none">
        <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNERPAY_CORDER" onDelete="none">
        <reference local="PAY_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_CORDER" onDelete="none">
        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNERBILL_CORDER" onDelete="none">
        <reference local="BILL_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPLOCATIONPAY_CORDER" onDelete="none">
        <reference local="PAY_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPARTNERLOCATION_CORDER" onDelete="none">
        <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPLOCATIONBILL_CORDER" onDelete="none">
        <reference local="BILL_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_CAMPAIGN" name="CCAMPAIGN_CORDER" onDelete="none">
        <reference local="C_CAMPAIGN_ID" foreign="C_CAMPAIGN_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_CASHLINE" name="CCASHLINE_CORDER" onDelete="none">
        <reference local="C_CASHLINE_ID" foreign="C_CASHLINE_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_CHARGE" name="CCHARGE_CORDER" onDelete="none">
        <reference local="C_CHARGE_ID" foreign="C_CHARGE_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_CONVERSIONTYPE" name="CCONVERSIONTYPE_CORDER" onDelete="none">
        <reference local="C_CONVERSIONTYPE_ID" foreign="C_CONVERSIONTYPE_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_CORDER" onDelete="none">
        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPETARGET_CORDER" onDelete="none">
        <reference local="C_DOCTYPETARGET_ID" foreign="C_DOCTYPE_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_DOCTYPE" name="C_DOCTYPE_CORDER" onDelete="none">
        <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENRVALUEUSER2_CORDER" onDelete="none">
        <reference local="USER2_ID" foreign="C_ELEMENTVALUE_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER1_CORDER" onDelete="none">
        <reference local="USER1_ID" foreign="C_ELEMENTVALUE_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_ORDER" name="CORDER_REF" onDelete="none">
        <reference local="REF_ORDER_ID" foreign="C_ORDER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_PAYMENT" name="CPAYMENT_CORDER" onDelete="none">
        <reference local="C_PAYMENT_ID" foreign="C_PAYMENT_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_PAYMENTTERM" name="CPAYMENTTERM_SOHEADER" onDelete="none">
        <reference local="C_PAYMENTTERM_ID" foreign="C_PAYMENTTERM_ID"/>
      </foreign-key>
      <foreign-key foreignTable="C_PROJECT" name="CPROJECT_CORDER" onDelete="none">
        <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
      </foreign-key>
      <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_SOHEADER" onDelete="none">
        <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
      </foreign-key>
      <foreign-key foreignTable="M_SHIPPER" name="MSHIPPER_CORDER" onDelete="none">
        <reference local="M_SHIPPER_ID" foreign="M_SHIPPER_ID"/>
      </foreign-key>
      <foreign-key foreignTable="M_WAREHOUSE" name="MWAREHOUSE_CORDER" onDelete="none">
        <reference local="M_WAREHOUSE_ID" foreign="M_WAREHOUSE_ID"/>
      </foreign-key>
      <index name="C_ORDER_BPARTNER">
        <index-column name="C_BPARTNER_ID"/>
      </index>
      <unique name="C_ORDER_DOCUMENTNO">
        <unique-column name="DOCUMENTNO"/>
        <unique-column name="C_DOCTYPE_ID"/>
        <unique-column name="C_BPARTNER_ID"/>
      </unique>
      <index name="C_ORDER_PROCESSED">
        <index-column name="AD_CLIENT_ID"/>
        <index-column name="PROCESSED"/>
      </index>
      <check>
        <rule><![CDATA[IsActive in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsSOTrx in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[Processed in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsApproved in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsCreditApproved in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsDelivered in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsInvoiced in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsPrinted in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsTransferred in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsSelected in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsDiscountPrinted in ('Y','N')]]></rule>
      </check>
      <check>
        <rule><![CDATA[IsTaxIncluded in ('Y','N')]]></rule>
      </check>
    </table>
  </database>
